{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _toArray from \"@babel/runtime/helpers/esm/toArray\";\nimport get from './get';\nfunction internalSet(entity, paths, value, removeIfUndefined) {\n  if (!paths.length) {\n    return value;\n  }\n  var _paths = _toArray(paths),\n    path = _paths[0],\n    restPath = _paths.slice(1);\n  var clone;\n  if (!entity && typeof path === 'number') {\n    clone = [];\n  } else if (Array.isArray(entity)) {\n    clone = _toConsumableArray(entity);\n  } else {\n    clone = _objectSpread({}, entity);\n  }\n  // Delete prop if `removeIfUndefined` and value is undefined\n  if (removeIfUndefined && value === undefined && restPath.length === 1) {\n    delete clone[path][restPath[0]];\n  } else {\n    clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined);\n  }\n  return clone;\n}\nexport default function set(entity, paths, value) {\n  var removeIfUndefined = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n  // Do nothing if `removeIfUndefined` and parent object not exist\n  if (paths.length && removeIfUndefined && value === undefined && !get(entity, paths.slice(0, -1))) {\n    return entity;\n  }\n  return internalSet(entity, paths, value, removeIfUndefined);\n}","map":{"version":3,"names":["_objectSpread","_toConsumableArray","_toArray","get","internalSet","entity","paths","value","removeIfUndefined","length","_paths","path","restPath","slice","clone","Array","isArray","undefined","set","arguments"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-util/es/utils/set.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _toArray from \"@babel/runtime/helpers/esm/toArray\";\nimport get from './get';\nfunction internalSet(entity, paths, value, removeIfUndefined) {\n  if (!paths.length) {\n    return value;\n  }\n  var _paths = _toArray(paths),\n    path = _paths[0],\n    restPath = _paths.slice(1);\n  var clone;\n  if (!entity && typeof path === 'number') {\n    clone = [];\n  } else if (Array.isArray(entity)) {\n    clone = _toConsumableArray(entity);\n  } else {\n    clone = _objectSpread({}, entity);\n  }\n  // Delete prop if `removeIfUndefined` and value is undefined\n  if (removeIfUndefined && value === undefined && restPath.length === 1) {\n    delete clone[path][restPath[0]];\n  } else {\n    clone[path] = internalSet(clone[path], restPath, value, removeIfUndefined);\n  }\n  return clone;\n}\nexport default function set(entity, paths, value) {\n  var removeIfUndefined = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n  // Do nothing if `removeIfUndefined` and parent object not exist\n  if (paths.length && removeIfUndefined && value === undefined && !get(entity, paths.slice(0, -1))) {\n    return entity;\n  }\n  return internalSet(entity, paths, value, removeIfUndefined);\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,GAAG,MAAM,OAAO;AACvB,SAASC,WAAW,CAACC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,iBAAiB,EAAE;EAC5D,IAAI,CAACF,KAAK,CAACG,MAAM,EAAE;IACjB,OAAOF,KAAK;EACd;EACA,IAAIG,MAAM,GAAGR,QAAQ,CAACI,KAAK,CAAC;IAC1BK,IAAI,GAAGD,MAAM,CAAC,CAAC,CAAC;IAChBE,QAAQ,GAAGF,MAAM,CAACG,KAAK,CAAC,CAAC,CAAC;EAC5B,IAAIC,KAAK;EACT,IAAI,CAACT,MAAM,IAAI,OAAOM,IAAI,KAAK,QAAQ,EAAE;IACvCG,KAAK,GAAG,EAAE;EACZ,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACX,MAAM,CAAC,EAAE;IAChCS,KAAK,GAAGb,kBAAkB,CAACI,MAAM,CAAC;EACpC,CAAC,MAAM;IACLS,KAAK,GAAGd,aAAa,CAAC,CAAC,CAAC,EAAEK,MAAM,CAAC;EACnC;EACA;EACA,IAAIG,iBAAiB,IAAID,KAAK,KAAKU,SAAS,IAAIL,Q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